package com.example.clxy.dao;

import com.example.clxy.entity.User;
import com.example.clxy.result.business.PageResult.UserPageResult;
import com.example.clxy.result.business.TeacherResult;
import com.example.clxy.result.business.UserAccountResult;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import javax.annotation.security.PermitAll;
import java.util.List;

@Repository
public interface UserMapper {
    int deleteByPrimaryKey(String userid);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(String userid);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    User loginWeb(@Param("account") String account,
                  @Param("password") String password,
                  @Param("roleid") String roleid);

    List<UserPageResult> getUserList(@Param("roleid") String roleid,
                                     @Param("teacherid") String teacherid,
                                     @Param("teachername") String teachername,
                                     @Param("grade") String grade,
                                     @Param("classid") String classid,
                                     @Param("studentname") String studentname,
                                     @Param("studentid") String studentid,
                                     @Param("begin") int begin,
                                     @Param("end") int end,
                                     @Param("pagesize") int pagesize);

    int resetPassword(@Param("account") String account,
                      @Param("password") String password);

    User getUserByAccount(String account);

    List<User> getUserListByClassid(String classid);

    List<TeacherResult> getTeacherResults(@Param("experimentid") String experimentid,
                                          @Param("startdate") String startdate,
                                          @Param("semesterid") String semesterid);

    User getUserByOpenid(String openid);

    void updateSessionKey(String session_key, String openid);

    String getStuPath(String studentid);

    int deleteStudentsbyclass(String classid);

    UserAccountResult getUserInfoByAccount(String account);

    int insertSessionKey(@Param("openid") String openid,
                         @Param("session_key") String session_key,
                         @Param("unionid") String unionid);

    int updateAccessToken(String accessToken);

    List<UserPageResult> getWxBindList(@Param("begin") int begin,
                                       @Param("end") int end,
                                       @Param("pagesize") int pagesize,
                                       @Param("roleid") String roleid,
                                       @Param("username") String username,
                                       @Param("account") String account);

    List<User> getTeacherList();
}